#!/bin/bash

set -e

# install -v -g sys -m700 -d /var/lib/sshd &&

# groupadd -g 50 sshd        &&
# useradd  -c 'sshd PrivSep' \
#          -d /var/lib/sshd  \
#          -g sshd           \
#          -s /bin/false     \
#          -u 50 sshd

./configure --prefix=/usr                            \
            --sysconfdir=/etc/ssh                    \
            --with-privsep-path=/var/lib/sshd        \
            --with-default-path=/usr/bin             \
            --with-superuser-path=/usr/sbin:/usr/bin \
            --with-pid-dir=/run                      &&
make

# make -j1 tests

make install &&
install -v -m755    contrib/ssh-copy-id /usr/bin     &&

install -v -m644    contrib/ssh-copy-id.1 \
                    /usr/share/man/man1              &&
install -v -m755 -d /usr/share/doc/openssh-9.9p2     &&
install -v -m644    INSTALL LICENCE OVERVIEW README* \
                    /usr/share/doc/openssh-9.9p2

# echo "PermitRootLogin no" >> /etc/ssh/sshd_config

# ssh-keygen &&
# ssh-copy-id -i ~/.ssh/id_ed25519.pub REMOTE_USERNAME@REMOTE_HOSTNAME

# echo "PasswordAuthentication no" >> /etc/ssh/sshd_config &&
# echo "KbdInteractiveAuthentication no" >> /etc/ssh/sshd_config

pushd /sources/blfs-systemd-units-20241211
    make install-sshd
popd
